package com.lp.entity;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "COLLECTOR_INSTANCE")
public class CollectorInstance implements Serializable {

	@SequenceGenerator(name = "SQNC_COLL_INST_GENERATOR", sequenceName = "SQNC_COLLECTOR_INSTANCE", allocationSize = 1)
	@Id
	@Column(name = "ID", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SQNC_COLL_INST_GENERATOR")
	private long id;

	@Column(name = "NAME")
	private String name;

	@Column(name = "RAW_DATA_DESC_ID", nullable = false)
	private long rawDataDescId;

	@Column(name = "SOURCE_POLLING_PERIOD")
	private Integer sourcePollingPeriod;

	@Column(name = "COLLECTOR_MANAGER_NAME")
	private String collectorManagerName;

	@Column(name = "COLLECTOR_CLASS_NAME")
	private String collectorClassName;

	@Column(name = "SOURCE_TIMEZONE")
	private String sourceTimezone;

	@Column(name = "LAST_COLLECTED_TIMESTAMP")
	private Timestamp lastCollectedTimestamp;

	@Column(name = "LAST_COLLECTED_INDEX")
	private Long lastCollectedIndex;

	@Column(name = "LAST_COLLECTED_FILE")
	private String lastCollectedFile;

	@Column(name = "COLLECTOR_ADMIN_STATE")
	private Long collectorAdminState;

	@Column(name = "COLLECTION_STATUS")
	private Long collectionStatus;

	@Column(name = "SRC_MODE_TYPE", nullable = false)
	private long srcModeType;

	@Column(name = "POLLING_COLUMN")
	private String pollingColumn;

	@Column(name = "MONITORED_COLUMN")
	private String monitoredColumn;

	@Column(name = "SQL_CONDITION")
	private String sqlCondition;

	@Column(name = "RESOURCE_MAPPING_TYPE")
	private String resourceMappingType;

	@Column(name = "RECORD_TIME_COLUMN")
	private String recordTimeColumn;

	@Column(name = "METRIC_SAMPLING_PERIOD")
	private Integer metricSamplingPeriod;

	@Column(name = "STARTUP_TYPE")
	private Integer startupType = 1;

	@Column(name = "CREATION_TIMESTAMP")
	private Timestamp creationTimestamp;

	@Column(name = "MODIFICATION_TIMESTAMP")
	private Timestamp modificationTimestamp;

	//	@OneToMany(mappedBy = "collectorInst", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	//	private Set<CollectorInstanceConfig> collectorInstConfigs;
	//
	//	@OneToMany(mappedBy = "collectorInstance", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	//	private Set<CollectorRawFieldDesc> collectorRawFieldDescCollection;

	private static final long serialVersionUID = 1L;

	public CollectorInstance() {
		super();
	}

	public long getId() {
		return this.id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCollectorManagerName() {
		return this.collectorManagerName;
	}

	public void setCollectorManagerName(String collectorManagerName) {
		this.collectorManagerName = collectorManagerName;
	}

	public String getCollectorClassName() {
		return this.collectorClassName;
	}

	public void setCollectorClassName(String collectorClassName) {
		this.collectorClassName = collectorClassName;
	}

	public String getSourceTimezone() {
		return this.sourceTimezone;
	}

	public void setSourceTimezone(String sourceTimezone) {
		this.sourceTimezone = sourceTimezone;
	}

	public Timestamp getLastCollectedTimestamp() {
		return this.lastCollectedTimestamp;
	}

	public void setLastCollectedTimestamp(Timestamp lastCollectedTimestamp) {
		this.lastCollectedTimestamp = lastCollectedTimestamp;
	}

	public String getLastCollectedFile() {
		return this.lastCollectedFile;
	}

	public void setLastCollectedFile(String lastCollectedFile) {
		this.lastCollectedFile = lastCollectedFile;
	}

	public String getPollingColumn() {
		return this.pollingColumn;
	}

	public void setPollingColumn(String pollingColumn) {
		this.pollingColumn = pollingColumn;
	}

	public String getMonitoredColumn() {
		return this.monitoredColumn;
	}

	public void setMonitoredColumn(String monitoredColumn) {
		this.monitoredColumn = monitoredColumn;
	}

	public String getSqlCondition() {
		return this.sqlCondition;
	}

	public void setSqlCondition(String sqlCondition) {
		this.sqlCondition = sqlCondition;
	}

	//	public Set<CollectorRawFieldDesc> getCollectorRawFieldDescCollection() {
	//		return this.collectorRawFieldDescCollection;
	//	}
	//
	//	public void setCollectorRawFieldDescCollection(Set<CollectorRawFieldDesc> collectorRawFieldDescCollection) {
	//		this.collectorRawFieldDescCollection = collectorRawFieldDescCollection;
	//	}

	public Integer getSourcePollingPeriod() {
		return sourcePollingPeriod;
	}

	public void setSourcePollingPeriod(Integer sourcePollingPeriod) {
		this.sourcePollingPeriod = sourcePollingPeriod;
	}

	public Long getLastCollectedIndex() {
		return lastCollectedIndex;
	}

	public void setLastCollectedIndex(Long lastCollectedIndex) {
		this.lastCollectedIndex = lastCollectedIndex;
	}

	public Long getCollectorAdminState() {
		return collectorAdminState;
	}

	public void setCollectorAdminState(Long collectorAdminState) {
		this.collectorAdminState = collectorAdminState;
	}

	public Long getCollectionStatus() {
		return collectionStatus;
	}

	public void setCollectionStatus(Long collectionStatus) {
		this.collectionStatus = collectionStatus;
	}

	public long getSrcModeType() {
		return srcModeType;
	}

	public void setSrcModeType(long srcModeType) {
		this.srcModeType = srcModeType;
	}

	//
	//	public Set<CollectorInstanceConfig> getCollectorInstConfigs() {
	//		return collectorInstConfigs;
	//	}
	//
	//	public void setCollectorInstConfigs(Set<CollectorInstanceConfig> collectorInstConfigs) {
	//		this.collectorInstConfigs = collectorInstConfigs;
	//	}

	public String getResourceMappingType() {
		return resourceMappingType;
	}

	public void setResourceMappingType(String resourceMappingType) {
		this.resourceMappingType = resourceMappingType;
	}

	public String getRecordTimeColumn() {
		return recordTimeColumn;
	}

	public void setRecordTimeColumn(String recordTimeColumn) {
		this.recordTimeColumn = recordTimeColumn;
	}

	public long getRawDataDescId() {
		return rawDataDescId;
	}

	public Integer getMetricSamplingPeriod() {
		return metricSamplingPeriod;
	}

	public void setMetricSamplingPeriod(Integer metricSamplingPeriod) {
		this.metricSamplingPeriod = metricSamplingPeriod;
	}

	public void setRawDataDescId(long rawDataDescId) {
		this.rawDataDescId = rawDataDescId;
	}

	public Integer getStartupType() {
		return startupType;
	}

	public void setStartupType(Integer startupType) {
		this.startupType = startupType;
	}

	public Timestamp getCreationTimestamp() {
		return creationTimestamp;
	}

	public void setCreationTimestamp(Timestamp creationTimestamp) {
		this.creationTimestamp = creationTimestamp;
	}

	public Timestamp getModificationTimestamp() {
		return modificationTimestamp;
	}

	public void setModificationTimestamp(Timestamp modificationTimestamp) {
		this.modificationTimestamp = modificationTimestamp;
	}

	//	public String getDestinationAlias(String fieldName) {
	//		if (collectorRawFieldDescCollection != null) {
	//			for (CollectorRawFieldDesc rawFieldDesc : collectorRawFieldDescCollection) {
	//				if (fieldName.equals(rawFieldDesc.getDestinationFieldName()))
	//					return rawFieldDesc.getDestinationFieldAlias();
	//			}
	//		}
	//		return null;
	//	}
	//
	//	public String getDescription(String fieldName) {
	//		if (collectorRawFieldDescCollection != null) {
	//			for (CollectorRawFieldDesc rawFieldDesc : collectorRawFieldDescCollection) {
	//				if (fieldName.equals(rawFieldDesc.getDestinationFieldName()))
	//					return rawFieldDesc.getDescription();
	//			}
	//		}
	//		return null;
	//	}

}
